<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="../../../common/taglib.jsp" %>

<%
	String tableName = request.getParameter("tableName");
	String detailTableName = request.getParameter("detailTableName");
	String pidName = request.getParameter("pidName");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>左边菜单树</title>
		<%@ include file="../../../common/import_common.jsp" %> 
		<%@ include file="../../../common/import_dhtmlx.jsp" %> 

		<script type="text/javascript">
		dhtmlx.skin = "dhx_skyblue";
		
		//** iframe自动适应页面 **//
		
		//输入你希望根据页面高度自动调整高度的iframe的名称的列表
		//用逗号把每个iframe的ID分隔. 例如: ["myframe1", "myframe2"]，可以只有一个窗体，则不用逗号。
		
		//定义iframe的ID
		var iframeids = [ "right" ];
		
		//如果用户的浏览器不支持iframe是否将iframe隐藏 yes 表示隐藏，no表示不隐藏
		var iframehide = "yes";
		
		function dyniframesize() {
			var dyniframe = new Array()
			for (i = 0; i < iframeids.length; i++) {
				if (document.getElementById) {
					//自动调整iframe高度
					dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
					if (dyniframe[i] && !window.opera) {
						dyniframe[i].style.display = "block"
						if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) { //如果用户的浏览器是NetScape
							dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight;
						} else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) { //如果用户的浏览器是IE
							dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
						}
					}
				}
				//根据设定的参数来处理不支持iframe的浏览器的显示问题
				if ((document.all || document.getElementById) && iframehide == "no") {
					var tempobj = document.all ? document.all[iframeids[i]] : document.getElementById(iframeids[i]);
					tempobj.style.display = "block"
				}
			}
		}
		
		if (window.addEventListener) {
			window.addEventListener("load", dyniframesize, false);
		} else if (window.attachEvent) {
			window.attachEvent("onload", dyniframesize)
		} else {
			window.onload = dyniframesize
		}
		
		</script>
	</head>

	<body scroll="no">

		<div class="main">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td valign="top" class="left">
						<!--  
						<div class="left_t">菜单</div>
						-->
						<div id="treeboxbox_tree" setImagePath="${ctx}/static/dhtmlx/imgs/"
							class="dhtmlxTree" style="height:750px"></div>
					</td>
					<td valign="top" class="right">

					</td>
				</tr>
			</table>
		</div>

		<script>
		String.prototype.replaceAll = function(s1, s2) {
			return this.replace(new RegExp(s1, "gm"), s2);
		}
		
		function doOnClick(itemId) {
			//alert("itemId = " + itemId);
			parent.document.getElementById("mainFrame").src = "treeList.jsp?tableName=<%=detailTableName%>&pidName=<%=pidName%>&<%=pidName%>=" + itemId + "&orderName=SHOW_ORDER&rnd=" + new Date();
		}
		
		menu_tree=new dhtmlXTreeObject(document.getElementById('treeboxbox_tree'),"100%", "100%",0);
		menu_tree.setImagePath("${ctx}/static/dhtmlx/imgs/");
		menu_tree.setOnClickHandler(doOnClick);
		menu_tree.enableThreeStateCheckboxes(false); 
		menu_tree.enableCheckBoxes(false);
		menu_tree.enableTreeLines(0);
						
		menu_tree.loadXML("getTreeData.jsp?tableName=<%=tableName%>&rnd=" + new Date() );//加载数据
		
		</script>
		
	</body>
</html>
